package cn.wowjoy.pda.android_pharmacy.mvvm.presenter.staticH;

import java.util.ArrayList;
import java.util.List;

import cn.wowjoy.pda.android_pharmacy.api.ApiService;
import cn.wowjoy.pda.android_pharmacy.common.core.BasePresenter;
import cn.wowjoy.pda.android_pharmacy.common.core.http.ServiceFactory;
import cn.wowjoy.pda.android_pharmacy.common.utils.PreferenceManager;
import cn.wowjoy.pda.android_pharmacy.common.widget.MDialog;
import cn.wowjoy.pda.android_pharmacy.model.xmlEntity.inHospitalPatientInfo.InHospitalPatientBeen;
import cn.wowjoy.pda.android_pharmacy.mvvm.vm.staticH.StaticCheckMedicineDetailViewModel;

/**
 * Created by Administrator on 2017/8/16.
 */

public class StaticCheckMedicineDetailPressenter extends BasePresenter<StaticCheckMedicineDetailViewModel> {
    //扫码传过来的集合
    public ArrayList<InHospitalPatientBeen> FitstData =new ArrayList<>();
    public List<InHospitalPatientBeen> inHospitalPatientBeens=new ArrayList<>();
    //订单号
    public String DJJLID;
    private ApiService mApiService;
    private MDialog waitDialog;
    @Override
    public void onCreatePresenter() {
        loadData();
        mApiService = (ApiService) ServiceFactory.getInstance().getService(ApiService.class);
    }


    public void loadData() {
        inHospitalPatientBeens = (List<InHospitalPatientBeen>) activity.getIntent().getExtras().getSerializable("inHospitalPatientBeenList");
        DJJLID=activity.getIntent().getExtras().getString("DJJLID");

        FitstData.clear();
        if(inHospitalPatientBeens != null && inHospitalPatientBeens.size() != 0){
            PreferenceManager.getInstance().setStaticCheckProgressTotal(inHospitalPatientBeens.size()+"");
            FitstData.addAll(inHospitalPatientBeens);
            if(FitstData!=null ){
                viewModel.setWData(FitstData);
            }
        }
    }
}
